home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / compak7 / dacpack7.exe / DLGroup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-12  |  13.5 KB  |  486 lines

  1. VERSION 5.00
  2. Object = "{1251FF75-D61A-11D1-A7CA-00C04FA30EBD}#1.0#0"; "DLGroup.dll"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DameWare Local Group Control Sample"
  5.    ClientHeight    =   6345
  6.    ClientLeft      =   5055
  7.    ClientTop       =   2940
  8.    ClientWidth     =   7470
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6345
  11.    ScaleWidth      =   7470
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.TextBox Text6 
  14.       Height          =   405
  15.       Left            =   120
  16.       TabIndex        =   4
  17.       Text            =   "Text6"
  18.       Top             =   3240
  19.       Width           =   2055
  20.    End
  21.    Begin VB.CommandButton Command12 
  22.       Caption         =   "Get Local Machine"
  23.       Height          =   375
  24.       Left            =   3960
  25.       TabIndex        =   7
  26.       Top             =   360
  27.       Width           =   1575
  28.    End
  29.    Begin VB.CommandButton Command11 
  30.       Caption         =   "Disconnect"
  31.       Height          =   375
  32.       Left            =   2280
  33.       TabIndex        =   17
  34.       Top             =   3720
  35.       Width           =   1575
  36.    End
  37.    Begin VB.TextBox Text5 
  38.       Height          =   405
  39.       Left            =   120
  40.       TabIndex        =   3
  41.       Text            =   "Text5"
  42.       Top             =   2520
  43.       Width           =   2055
  44.    End
  45.    Begin VB.CommandButton Command10 
  46.       Caption         =   "Get Current User"
  47.       Height          =   375
  48.       Left            =   5640
  49.       TabIndex        =   10
  50.       Top             =   1080
  51.       Width           =   1575
  52.    End
  53.    Begin VB.CommandButton Command9 
  54.       Caption         =   "Remove Member"
  55.       Height          =   375
  56.       Left            =   3960
  57.       TabIndex        =   15
  58.       Top             =   2280
  59.       Width           =   1575
  60.    End
  61.    Begin VB.CommandButton Command8 
  62.       Caption         =   "Add Member"
  63.       Height          =   375
  64.       Left            =   2280
  65.       TabIndex        =   14
  66.       Top             =   2280
  67.       Width           =   1575
  68.    End
  69.    Begin VB.CommandButton Command7 
  70.       Caption         =   "Connect"
  71.       Height          =   375
  72.       Left            =   2280
  73.       TabIndex        =   16
  74.       Top             =   3240
  75.       Width           =   1575
  76.    End
  77.    Begin VB.TextBox Text4 
  78.       Height          =   405
  79.       IMEMode         =   3  'DISABLE
  80.       Left            =   120
  81.       PasswordChar    =   "*"
  82.       TabIndex        =   5
  83.       Text            =   "Text4"
  84.       Top             =   3960
  85.       Width           =   2055
  86.    End
  87.    Begin VB.CommandButton Command6 
  88.       Caption         =   "Delete Group"
  89.       Height          =   375
  90.       Left            =   5640
  91.       TabIndex        =   13
  92.       Top             =   1800
  93.       Width           =   1575
  94.    End
  95.    Begin VB.CommandButton Command5 
  96.       Caption         =   "Add Group"
  97.       Height          =   375
  98.       Left            =   3960
  99.       TabIndex        =   12
  100.       Top             =   1800
  101.       Width           =   1575
  102.    End
  103.    Begin VB.CommandButton Command4 
  104.       Caption         =   "IsMember"
  105.       Height          =   375
  106.       Left            =   3960
  107.       TabIndex        =   9
  108.       Top             =   1080
  109.       Width           =   1575
  110.    End
  111.    Begin VB.CommandButton Command3 
  112.       Caption         =   "Get Group Users"
  113.       Height          =   375
  114.       Left            =   2280
  115.       TabIndex        =   11
  116.       Top             =   1800
  117.       Width           =   1575
  118.    End
  119.    Begin VB.TextBox Text3 
  120.       Height          =   405
  121.       Left            =   120
  122.       TabIndex        =   2
  123.       Text            =   "Text3"
  124.       Top             =   1800
  125.       Width           =   2055
  126.    End
  127.    Begin VB.ListBox List1 
  128.       Height          =   1815
  129.       Left            =   120
  130.       Sorted          =   -1  'True
  131.       TabIndex        =   18
  132.       Top             =   4440
  133.       Width           =   7215
  134.    End
  135.    Begin VB.CommandButton Command2 
  136.       Caption         =   "Get User Groups"
  137.       Height          =   375
  138.       Left            =   2280
  139.       TabIndex        =   8
  140.       Top             =   1080
  141.       Width           =   1575
  142.    End
  143.    Begin VB.CommandButton Command1 
  144.       Caption         =   "Get All Groups"
  145.       Default         =   -1  'True
  146.       Height          =   375
  147.       Left            =   2280
  148.       TabIndex        =   6
  149.       Top             =   360
  150.       Width           =   1575
  151.    End
  152.    Begin VB.TextBox Text2 
  153.       Height          =   405
  154.       Left            =   120
  155.       TabIndex        =   1
  156.       Text            =   "Text2"
  157.       Top             =   1080
  158.       Width           =   2055
  159.    End
  160.    Begin VB.TextBox Text1 
  161.       Height          =   405
  162.       Left            =   120
  163.       TabIndex        =   0
  164.       Text            =   "Text1"
  165.       Top             =   360
  166.       Width           =   2055
  167.    End
  168.    Begin VB.Label Label7 
  169.       Caption         =   "Connect UserID"
  170.       Height          =   255
  171.       Left            =   120
  172.       TabIndex        =   26
  173.       Top             =   3000
  174.       Width           =   1215
  175.    End
  176.    Begin VB.Label Label6 
  177.       Caption         =   "Label6"
  178.       Height          =   255
  179.       Left            =   6000
  180.       TabIndex        =   25
  181.       Top             =   4080
  182.       Width           =   1215
  183.    End
  184.    Begin VB.Shape Shape1 
  185.       BackStyle       =   1  'Opaque
  186.       FillColor       =   &H00FFFFFF&
  187.       FillStyle       =   0  'Solid
  188.       Height          =   375
  189.       Left            =   5760
  190.       Shape           =   3  'Circle
  191.       Top             =   360
  192.       Width           =   495
  193.    End
  194.    Begin DLGROUPLibCtl.DLGroupCtl DLGroupCtl1 
  195.       Height          =   480
  196.       Left            =   6600
  197.       TabIndex        =   24
  198.       Top             =   360
  199.       Width           =   480
  200.       _cx             =   4457295
  201.       _cy             =   4457295
  202.    End
  203.    Begin VB.Label Label5 
  204.       Caption         =   "Group Comment"
  205.       Height          =   255
  206.       Left            =   120
  207.       TabIndex        =   23
  208.       Top             =   2280
  209.       Width           =   2055
  210.    End
  211.    Begin VB.Label Label4 
  212.       Caption         =   "Password"
  213.       Height          =   255
  214.       Left            =   120
  215.       TabIndex        =   22
  216.       Top             =   3720
  217.       Width           =   2055
  218.    End
  219.    Begin VB.Label Label3 
  220.       Caption         =   "Group"
  221.       Height          =   255
  222.       Left            =   120
  223.       TabIndex        =   21
  224.       Top             =   1560
  225.       Width           =   2055
  226.    End
  227.    Begin VB.Label Label2 
  228.       Caption         =   "User ID"
  229.       Height          =   255
  230.       Left            =   120
  231.       TabIndex        =   20
  232.       Top             =   840
  233.       Width           =   1935
  234.    End
  235.    Begin VB.Label Label1 
  236.       Caption         =   "Machine Name"
  237.       Height          =   255
  238.       Left            =   120
  239.       TabIndex        =   19
  240.       Top             =   120
  241.       Width           =   2055
  242.    End
  243. Attribute VB_Name = "Form1"
  244. Attribute VB_GlobalNameSpace = False
  245. Attribute VB_Creatable = False
  246. Attribute VB_PredeclaredId = True
  247. Attribute VB_Exposed = False
  248. Private Sub Check1_Click()
  249. On Error GoTo ErrorHandler
  250. Exit Sub
  251. ErrorHandler:
  252.     OnErrorHandler
  253.     'Resume Next
  254. End Sub
  255. Private Sub Command1_Click()
  256. On Error GoTo ErrorHandler
  257. List1.Clear
  258. Shape1.FillColor = &H80FFFF    'yellow busy
  259. Shape1.Refresh
  260. DLGroupCtl1.Machine = Text1.Text
  261. DLGroupCtl1.SetFirstGroup
  262. i = 0
  263. While DLGroupCtl1.GroupGetNext <> 0
  264.     List1.AddItem DLGroupCtl1.Group + Chr(9) + DLGroupCtl1.GroupComment
  265.     i = i + 1
  266.     Label6.Caption = "Count: " + Str(i)
  267.     Label6.Refresh
  268. Shape1.FillColor = &H80FF80 ' green - returned ok
  269. Shape1.Refresh
  270. Exit Sub
  271. ErrorHandler:
  272.     OnErrorHandler
  273. Shape1.FillColor = &HFF&       ' red - failed
  274. Shape1.Refresh
  275.     'Resume Next
  276. End Sub
  277. Private Sub Command10_Click()
  278. On Error GoTo ErrorHandler
  279. Shape1.FillColor = &H80FFFF    'yellow busy
  280. Shape1.Refresh
  281. Text2.Text = DLGroupCtl1.GetCurrentUserID
  282. Shape1.FillColor = &H80FF80 ' green - returned ok
  283. Shape1.Refresh
  284. Exit Sub
  285. ErrorHandler:
  286.     OnErrorHandler
  287.     'Resume Next
  288. Shape1.FillColor = &HFF&       ' red - failed
  289. Shape1.Refresh
  290. End Sub
  291. Private Sub Command11_Click()
  292. On Error GoTo ErrorHandler
  293. Shape1.FillColor = &H80FFFF    'yellow busy
  294. Shape1.Refresh
  295. DLGroupCtl1.Machine = Text1.Text
  296. DLGroupCtl1.UserDisconnect
  297. Shape1.FillColor = &H80FF80 ' green - returned ok
  298. Shape1.Refresh
  299. Exit Sub
  300. ErrorHandler:
  301.     OnErrorHandler
  302.     'Resume Next
  303. Shape1.FillColor = &HFF&       ' red - failed
  304. Shape1.Refresh
  305. End Sub
  306. Private Sub Command12_Click()
  307. Shape1.FillColor = &H80FFFF    'yellow busy
  308. Shape1.Refresh
  309. Text1.Text = DLGroupCtl1.GetMachineName
  310. Shape1.FillColor = &H80FF80 ' green - returned ok
  311. Shape1.Refresh
  312. End Sub
  313. Private Sub Command2_Click()
  314. On Error GoTo ErrorHandler
  315. Dim Count As Long
  316. List1.Clear
  317. Shape1.FillColor = &H80FFFF    'yellow busy
  318. Shape1.Refresh
  319. DLGroupCtl1.Machine = Text1.Text
  320. DLGroupCtl1.UserID = Text2.Text
  321. DLGroupCtl1.SetFirstUserGroup
  322. i = 0
  323. While DLGroupCtl1.UserGroupGetNext <> 0
  324.     List1.AddItem DLGroupCtl1.Group
  325.     i = i + 1
  326.     Label6.Caption = "Count: " + Str(i)
  327.     Label6.Refresh
  328. Shape1.FillColor = &H80FF80 ' green - returned ok
  329. Shape1.Refresh
  330. Exit Sub
  331. ErrorHandler:
  332.     OnErrorHandler
  333.     'Resume Next
  334. Shape1.FillColor = &HFF&       ' red - failed
  335. Shape1.Refresh
  336. End Sub
  337. Private Sub Command3_Click()
  338. On Error GoTo ErrorHandler
  339. List1.Clear
  340. Shape1.FillColor = &H80FFFF    'yellow busy
  341. Shape1.Refresh
  342. DLGroupCtl1.Machine = Text1.Text
  343. DLGroupCtl1.Group = Text3.Text
  344. DLGroupCtl1.SetFirstUser
  345. i = 0
  346. While DLGroupCtl1.UserGetNext <> 0
  347.     List1.AddItem DLGroupCtl1.UserID
  348.     i = i + 1
  349.     Label6.Caption = "Count: " + Str(i)
  350.     Label6.Refresh
  351. Shape1.FillColor = &H80FF80 ' green - returned ok
  352. Shape1.Refresh
  353. Exit Sub
  354. ErrorHandler:
  355.     OnErrorHandler
  356.     'Resume Next
  357. Shape1.FillColor = &HFF&       ' red - failed
  358. Shape1.Refresh
  359. End Sub
  360. Private Sub Command4_Click()
  361. On Error GoTo ErrorHandler
  362. Shape1.FillColor = &H80FFFF    'yellow busy
  363. Shape1.Refresh
  364. Form1.Refresh
  365. DLGroupCtl1.Machine = Text1.Text
  366. DLGroupCtl1.UserID = Text2.Text
  367. DLGroupCtl1.Group = Text3.Text
  368. If DLGroupCtl1.IsMember = False Then
  369.     MsgBox "User " + DLGroupCtl1.UserID + " Is NOT Member of group " + Text3.Text
  370.     MsgBox "User " + DLGroupCtl1.UserID + " Is Member of group " + Text3.Text
  371. End If
  372. Shape1.FillColor = &H80FF80 ' green - returned ok
  373. Shape1.Refresh
  374. Exit Sub
  375. ErrorHandler:
  376.     OnErrorHandler
  377.     'Resume Next
  378. Shape1.FillColor = &HFF&       ' red - failed
  379. Shape1.Refresh
  380. End Sub
  381. Private Sub Command5_Click()
  382. On Error GoTo ErrorHandler
  383. Shape1.FillColor = &H80FFFF    'yellow busy
  384. Shape1.Refresh
  385. DLGroupCtl1.Machine = Text1.Text
  386. DLGroupCtl1.Group = Text3.Text
  387. DLGroupCtl1.GroupComment = Text5.Text
  388. DLGroupCtl1.GroupAdd
  389. Shape1.FillColor = &H80FF80 ' green - returned ok
  390. Shape1.Refresh
  391. Exit Sub
  392. ErrorHandler:
  393.     OnErrorHandler
  394.     'Resume Next
  395. Shape1.FillColor = &HFF&       ' red - failed
  396. Shape1.Refresh
  397. End Sub
  398. Private Sub Command6_Click()
  399. On Error GoTo ErrorHandler
  400. Shape1.FillColor = &H80FFFF    'yellow busy
  401. Shape1.Refresh
  402. DLGroupCtl1.Machine = Text1.Text
  403. DLGroupCtl1.Group = Text3.Text
  404. DLGroupCtl1.GroupRemove
  405. Shape1.FillColor = &H80FF80 ' green - returned ok
  406. Shape1.Refresh
  407. Exit Sub
  408. ErrorHandler:
  409.     OnErrorHandler
  410.     'Resume Next
  411. Shape1.FillColor = &HFF&       ' red - failed
  412. Shape1.Refresh
  413. End Sub
  414. Private Sub Command7_Click()
  415. On Error GoTo ErrorHandler
  416. Shape1.FillColor = &H80FFFF    'yellow busy
  417. Shape1.Refresh
  418. DLGroupCtl1.Machine = Text1.Text
  419. DLGroupCtl1.UserID = Text6.Text
  420. DLGroupCtl1.Password = Text4.Text
  421. DLGroupCtl1.UserConnect
  422. Shape1.FillColor = &H80FF80 ' green - returned ok
  423. Shape1.Refresh
  424. Exit Sub
  425. ErrorHandler:
  426.     OnErrorHandler
  427.     'Resume Next
  428. Shape1.FillColor = &HFF&       ' red - failed
  429. Shape1.Refresh
  430. End Sub
  431. Private Sub Command8_Click()
  432. On Error GoTo ErrorHandler
  433. Shape1.FillColor = &H80FFFF    'yellow busy
  434. Shape1.Refresh
  435. DLGroupCtl1.Machine = Text1.Text
  436. DLGroupCtl1.UserID = Text2.Text
  437. DLGroupCtl1.Group = Text3.Text
  438. DLGroupCtl1.GroupAddMember
  439. Shape1.FillColor = &H80FF80 ' green - returned ok
  440. Shape1.Refresh
  441. Exit Sub
  442. ErrorHandler:
  443.     OnErrorHandler
  444.     'Resume Next
  445. Shape1.FillColor = &HFF&       ' red - failed
  446. Shape1.Refresh
  447. End Sub
  448. Private Sub Command9_Click()
  449. On Error GoTo ErrorHandler
  450. Shape1.FillColor = &H80FFFF    'yellow busy
  451. Shape1.Refresh
  452. DLGroupCtl1.Machine = Text1.Text
  453. DLGroupCtl1.UserID = Text2.Text
  454. DLGroupCtl1.Group = Text3.Text
  455. DLGroupCtl1.GroupRemoveMember
  456. Shape1.FillColor = &H80FF80 ' green - returned ok
  457. Shape1.Refresh
  458. Exit Sub
  459. ErrorHandler:
  460.     OnErrorHandler
  461.     'Resume Next
  462. Shape1.FillColor = &HFF&       ' red - failed
  463. Shape1.Refresh
  464. End Sub
  465. Private Sub Form_Load()
  466. On Error GoTo ErrorHandler
  467. Text1.Text = DLGroupCtl1.GetMachineName
  468. Text2.Text = DLGroupCtl1.GetCurrentUserID
  469. Text3.Text = ""
  470. Text4.Text = ""
  471. Text5.Text = ""
  472. Text6.Text = DLGroupCtl1.GetCurrentUserID
  473. Label6.Caption = "Count:    "
  474. Shape1.FillColor = &H80FF80 ' green - returned ok
  475. Shape1.Refresh
  476. Exit Sub
  477. ErrorHandler:
  478.     OnErrorHandler
  479.     'Resume Next
  480. End Sub
  481. Sub OnErrorHandler()
  482. If Err.Number <> 0 Then
  483.     MsgBox Err.Description, , "Error"
  484. End If
  485. End Sub
  486.